package TestThread;

public class demo6 {
    public static void main(String[] args) throws InterruptedException {
        Thread mainThread = Thread.currentThread();
        Thread thread = new Thread(() -> {
            while (true) {
                try {
                    System.out.println("主线程的状态：" + mainThread.getState());
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }

        });
        thread.start();
        Thread.sleep(1000);
        //thread.join(1000);
        thread.join();
    }
}
